﻿HmJS.$Import('crypt.string.cryptographyhex');
HmJS.$Import('crypt.string.cryptographyutf8');
HmJS.$Import('crypt.string.cryptographybase64');
HmJS.$Import('crypt.string.cryptographycrc32');
HmJS.$Import('crypt.string.cryptographymd5');
HmJS.$Import('crypt.string.cryptographyrmd160');
HmJS.$Import('crypt.string.cryptographysha1');
HmJS.$Import('crypt.string.cryptographysha256');
HmJS.$Import('crypt.string.cryptographysha512');
HmJS.$Import('crypt.string.cryptographyslug');
HmJS.$Import('core.element');

HmJS.register('demo.module.crypt.cryptography', function ($ns) {
	var that = {};

	that.todo = function () {
		var $ = document.id;

		var result = 'Chris the Developer'.toHex();
		$('toHex').set('text', 'toHex:' + result);
		$('fromHex').set('text', 'fromHex:' + result.fromHex());

		var result = '中华人民共和国'.toUTF8();
		$('toUTF8').set('text', 'toUTF8:' + result);
		$('fromUTF8').set('text', 'fromUTF8:' + result.fromUTF8());

		var result = 'Chris the Developer'.toBase64();
		$('toBase64').set('text', 'toBase64:' + result);
		$('fromBase64').set('text', 'fromBase64:' + result.fromBase64());

		$('tocrc32').set('text', 'Output: ' + 'Chris the Developer'.toCRC32());

		$('tomd5').set('text', 'Output: ' + 'Chris the Developer'.toMD5());

		$('tormd160').set('text', 'Output: ' + 'Chris the Developer'.toRMD160());

		$('tosha1').set('text', 'Output: ' + 'Chris the Developer'.toSHA1());

		$('tosha256').set('text', 'Output: ' + 'Chris the Developer'.toSHA256());

		$('tosha512').set('text', 'Output: ' + 'Chris the Developer'.toSHA512());

		$('toslug').set('text', 'Output: ' + 'Chr韘 th?D雟雔op雛'.toSlug());
	};

	return that;
});
